﻿using ComponentFactory.Krypton.Ribbon;
using StableDiffusionTools.Framework;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace LLMEvaluation.Framework
{
    public class LLMEvaluationSettings : Settings
    {
        public string LastPath { get; set; } = "";
        public FilterType LastFilterType { get; set; } = FilterType.Prompt;
        public Size LastFilterSize { get; set; } = Size.Empty;
        public Size LastMarkingSize { get; set; } = Size.Empty;
        public Size LastModelSelectionSize { get; set; } = Size.Empty;
        public Size LastOverviewSize { get; set; } = Size.Empty;
        public int LastSidePanelWidth { get; set; } = -1;
        public int LastSidePanelHeight { get; set; } = -1;
        public bool TrackActiveModel { get; set; } = false;
        public bool ShowRibbon { get; set; } = true;
        public QATLocation QATLocation { get; set; } = QATLocation.Above;
        public bool QuitConfirmation = true;
        public bool LoadConfirmation = true;
        public string WebUIServer { get; set; } = "127.0.0.1";
        public int WebUIPort { get; set; } = 5000;
        public string WebUIOAuthToken { get; set; } = "";
        public List<string> LeftPages { get; set; } = new List<string>();
        public List<string> TopPages { get; set; } = new List<string>();
        public List<string> BottomPages { get; set; } = new List<string>();
        public List<string> QATButtons { get; set; }
        public InferenceOrder InferenceOrder { get; set; } = InferenceOrder.Run;
        public XmlColor ActionColor { get; set; } = Color.DimGray;
        public XmlColor QuotedColor { get; set; } = Color.Goldenrod;
        public float? Temperature { get; set; } = null;
        [XmlIgnore] public bool TemperatureSpecified { get { return Temperature != null; } }
        public float? FrequencyPenalty { get; set; } = null;
        [XmlIgnore] public bool FrequencyPenaltySpecified { get { return FrequencyPenalty != null; } }
        public float? PresencePenalty { get; set; } = null;
        [XmlIgnore] public bool PresencePenaltySpecified { get { return PresencePenalty != null; } }
        public float? TopP { get; set; } = null;
        [XmlIgnore] public bool TopPSpecified { get { return TopP != null; } }
        public int? TopK { get; set; } = null;
        [XmlIgnore] public bool TopKSpecified { get { return TopK != null; } }
        public int? MaxTokens { get; set; } = null;
        [XmlIgnore] public bool MaxTokensSpecified { get { return MaxTokens != null; } }
        public int? MaxTokensSecond { get; set; } = null;
        [XmlIgnore] public bool MaxTokensSecondSpecified { get { return MaxTokensSecond != null; } }

        public override void EndInit()
        {
            if(QATButtons == null)
                QATButtons = new List<string>(new string[] { "Connect" });
        }
    }
}
